package com.swak.frame.exception;

import com.swak.frame.dto.base.RestApiCode;
import com.swak.frame.dto.base.SysRestCode;

/**
 * ClassName: ApiException.java
 * 
 * @Description: ApiException
 * @author colley.ma
 * @date 2021年3月15日
 */
public class ApiException extends BaseException {
	private static final long serialVersionUID = 93795359413720383L;

	public ApiException(String errMessage) {
		super(errMessage);
		this.setErrCode(SysRestCode.SYS_ERR);
	}

	public ApiException(Throwable e) {
		super(SysRestCode.SYS_ERR.getRetCode(), 
				SysRestCode.SYS_ERR.getRetMessage(), e);
	}

	public ApiException(RestApiCode errCode) {
		super(errCode.getRetMessage());
		this.setErrCode(errCode);
	}

	public ApiException(RestApiCode errCode, String errMessage) {
		super(errMessage);
		this.setErrCode(errCode);
	}

	public ApiException(String errMessage, Throwable e) {
		super(errMessage, e);
	}

	public ApiException(RestApiCode errorCode, String errMessage, Throwable e) {
		super(errMessage, e);
		this.setErrCode(errorCode);
	}

	public ApiException(RestApiCode errCode, Throwable e) {
		super(errCode.getRetCode(), errCode.getRetMessage(), e);
	}

	public ApiException(String errorCode, String er) {
		super(er);
		this.setErrCode(errorCode);
	}
}
